import cv2
cap = cv2.VideoCapture("/dev/video0", cv2.CAP_V4L2)  
exposure_before = cap.get(cv2.CAP_PROP_EXPOSURE)
print("before changed:", exposure_before)
_, img1 = cap.read()
cv2.imwrite("img1.png", img1)
cap.set(cv2.CAP_PROP_EXPOSURE, 50)
cap.release()
cap1 = cv2.VideoCapture("/dev/video0", cv2.CAP_V4L2)  
exposure_after = cap1.get(cv2.CAP_PROP_EXPOSURE)
_, img2 = cap1.read()
cv2.imwrite("img2.png", img2)
cap.set(cv2.CAP_PROP_EXPOSURE, -7)
_, img3 = cap1.read()
cv2.imwrite("img3.png", img3)
print("after changed:", exposure_after)
cap1.release()
cv2.waitKey(10000)
cv2.destroyAllWindows()